package com.example.base.log;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class LogModel {

    private String className;

    private List<String> logList;

    public LogModel(String className) {
        this.className = className;
        logList=new ArrayList<>();
    }

    public void addLog(String className,String log){
        if(this.className.equals(className)){
            logList.add(log);
        }
    }

    public String getLogStr(){
        StringBuilder stringBuilder=new StringBuilder();
        for (int i = 0; i < logList.size() ; i++) {
            String str=logList.get(i);
            stringBuilder.append(str).append("\n");
        }
        return stringBuilder.toString();
    }
}
